#ifndef LOWPASS_H
#define LOWPASS_H

#include <Arduino.h>

class LowPassFilter {
public:
    // Initialize filter with default 2Hz cutoff at 5kHz sampling
    LowPassFilter();
    
    // Initialize filter with specified cutoff frequency (Hz) at 5kHz sampling
    LowPassFilter(float cutoff_freq);
    
    // Update filter with new input
    float update(float input);
    
    // Get current filtered value
    float getValue() const { return y1; }
    
    // Reset filter state
    void reset() { y1 = 0.0f; }

private:
    float a1;  // Filter coefficient
    float b0;  // Filter coefficient    
    float y1;  // Previous output
    
    // Calculate coefficients for given cutoff frequency
    void calculateCoefficients(float cutoff_freq);
};

#endif // LOWPASS_H
